/*******************************************************************************
 * Copyright 2008 www.softao.com
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
/**
 * Place holder for copyright, needs to be replaced before release.
 */
package com.softao.ming.gwt.drawing2d.client.ui.impl;

import com.google.gwt.user.client.Element;

/**
 * Wraps IE6 related feature.
 */
public class GraphicsImplVmlIE6 extends GraphicsImplVml {
	private Element mElement;
	
	@Override
	public void initialize(Element element) {
		super.initialize(element);
		this.mElement = element;
		this.initializeIE6();
	}
	
	/**
	 * @return the element
	 */
	@Override
	public final Element getElement() {
		return mElement;
	}
	
	private native void initializeIE6() /*-{
		var oVml, oStyle, nodes, element;
		element = this.@com.softao.ming.gwt.drawing2d.client.ui.impl.GraphicsImplVml::mElement;
		element.style.position = 'relative';
		element.style.display  = 'block';
		element.style.overflow = 'hidden';

		oVml = $doc.getElementById('VMLRender');
		if (oVml) { return; }
		
		$doc.namespaces.add("vml");
		oVml = $doc.createElement('object');
		oVml.id = 'VMLRender';
		oVml.codebase = 'vgx.dll';
		oVml.classid = 'CLSID:10072CEC-8CC1-11D1-986E-00A0C955B42E';
		$doc.body.appendChild(oVml);
	
		oStyle = $doc.createStyleSheet();
		oStyle.addRule('vml\\:*', "behavior: url(#VMLRender);");
	}-*/;
}
